package cn.lcsjsxy.yxz.constructorexercises;

public class triangle {

    //5.11
    //编写两个类，TriAngle和TriAngleTest，其中TriAngle类中声明私有的底边长base和高height，同时声明公共方法访问私有变量。
    //此外，提供类必要的构造器。另一个类中使用这些公共方法，计算三角形的面积。

    //测试
    public static void main(String[] args) {
        triangle t1 = new triangle();
        t1.setBese(666.0);
        t1.setHeight(666.6);
        System.out.println("base : " + t1.getBese() + ",height : " + t1.getHeight());

        triangle t2 = new triangle(5.1,5.2);
        System.out.println("base : " + t2.getBese() + ",height : " + t2.getHeight());
    }

    private double base;//边长
    private double height;//高

    public triangle(){

    }
    public triangle(double b,double h){
        base = b;
        height = h;
    }



    public void setBese(double b){
        base = b;
    }

    public double getBese(){
        return  base;
    }
    public void setHeight(double h){
        height = h;
    }
    public double getHeight(){
        return height;
    }
}
